using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Diagnostics;


namespace WPFPhysics1
{
	/// <summary>
	/// Interaction logic for Window1.xaml
	/// </summary>

	public partial class Window1 : System.Windows.Window
	{
		public Window1()
		{
			InitializeComponent();

			ObjectDataProvider data = Resources[ "bodies" ] as ObjectDataProvider;
			Bodies bodies = data.Data as Bodies;
			bodies.SetPlatforms();
			bodies.DropObjects( BodyType.Ellipse );
		}

		protected void Drop_Click( object sender, RoutedEventArgs e )
		{
			ObjectDataProvider data = Resources[ "bodies" ] as ObjectDataProvider;
			Bodies bodies = data.Data as Bodies;
			Button button = sender as Button;

			if ( bodies != null && button != null )
			{
				switch ( button.Name )
				{
					case "rectangle":

						bodies.DropObjects( BodyType.Rectangle );
						break;

					case "ellipse":

						bodies.DropObjects( BodyType.Ellipse );
						break;

					case "polygon":

						bodies.DropObjects( BodyType.Polygon );
						break;

					case "car":

						bodies.DropObjects( BodyType.Car );
						break;

					case "platforms":

						bodies.SetPlatforms();
						break;
				}
			}
		}
	}
}